
#!/bin/bash



function sync_code()
{
	git pull
	git submodule update --init --recursive
}

function update_tag() 
{
	ctags -R * --exclude=3rd
	#ctags --langmap=c:+.h --languages=c,c++ --c-kinds=+p -R
	echo "update tag"
}

function install_vim_tool()
{
	
	cd vim_tool
	#rm -rf doc/
	#rm -rf plugin/
	#rm -rf autoload/
	#rm -rf pack/
	#rm -rf after/
	rm -rf .vim/

	#unzip tag.zip
	#unzip winmanager.zip
	#unzip auto.zip
	#unzip omni.zip

	# tar -zcvf vim.tar.gz
	tar -zxvf vim.tar.gz

	#cp -R doc/ ~/.vim/
	mkdir ~/.vim/
	cp -R .vim/ ~/
	#cp -R plugin/ ~/.vim/plugin
	#cp -R after/ ~/.vim/after
	#cp -R autoload/ ~/.vim/autoload


	cp -R .vimrc ~/.vimrc
	#rm -rf doc/
	#rm -rf plugin/
	#rm -rf autoload/
	#rm -rf pack/
	#rm -rf after/


	rm -rf ctags-5.6/
	tar -xzvf tag.tar.gz
	cd ctags-5.6 
	./configure
	make
	cp ctags ../ctags
	cd ..
	#make install 
	rm -rf ctags-5.6/
	echo "cp vim_tool/ctags /usr/local/bin/ctags"
}

function no_function()
{

	echo "no function"
}

echo "vim plugin install "

if [ $# != 1 ] ; then
	echo "USAGE PARAM : $0 ins | tag"
	exit 1;
fi 


if [ $1 == "ins" ];
	then
	install_vim_tool
elif  [ $1 == "tag" ]; 
	then
	update_tag
elif  [ $1 == "sync" ]; 
	then
	sync_code
else
	no_function
fi




